*******************************************************************************
* Replication data for "Empowering women in central banking"

* Contact: bernhard.reinsberg@glasgow.ac.uk
* Date: 12 July 2024
*******************************************************************************

* Data and variables
********************

  use "JEPP_replication", clear 
  
  g onset=IMFonset
  replace onset=. if IMFnn==1 & l.IMFnn==1 & (IMFonset!=1)
  g ongoing=IMFongoing
  replace ongoing=. if onset==1
   
  g lnfdi=asinh(fdi_inper)
  g loginfl=asinh(infl)
  
  global X1 f_lead f_fm vdem_gender leftany
  global X2 $X1 lngdppc fh_inv lnfdi crd_gov crd_prv
  
  global LX1 l.f_lead l.f_fm l.vdem_gender l.leftany
  global LX2 $LX1 l.lngdppc l.fh_inv l.lnfdi l.crd_gov l.crd_prv
  global LX3 $LX2 l.growth l.loginfl
  
  global L2X1 l2.f_lead l2.f_fm l2.vdem_gender l2.leftany
  global L2X2 $L2X1 l2.lngdppc l2.fh_inv l2.lnfdi l2.crd_gov l2.crd_prv
  global L2X3 $L2X2 l2.growth l2.loginfl 
  
  xtset cid year 
  

* Main analyses
*************** 
  
* Baseline specification and lag structure
  qui reghdfe women_appointment l.crisis_LV l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store b11
  qui reghdfe women_appointment l.crisis_sd l.crisis_bk l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store b12
  qui reghdfe women_appointment l.crisis_sd l.crisis_bk l.crisis_cur l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store b13
estout b1*, drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))

** Table 1
estout b1*, style(tex) substitute(_ \_) drop(_cons ) order(*cris*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3) label("Observations" "Countries" "Adjusted-R2")) 


* Additional control variables
  qui reghdfe women_appointment l2.crisis_sd $L2X1 l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store b21
  qui reghdfe women_appointment l2.crisis_sd $L2X2 l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store b22
  qui reghdfe women_appointment l2.crisis_sd $L2X3 l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store b23
estout b2*, drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))

** Table 2 
estout b2*, style(tex) substitute(_ \_) drop(_cons ) order(*cris*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3) label("Observations" "Countries" "Adjusted-R2")) 


* Substantive outcomes (event-study window design)
  g WDW_LV=f3.crisis_LV==1|f2.crisis_LV==1|f.crisis_LV==1| crisis_LV==1 | l.crisis_LV==1|l2.crisis_LV==1|l3.crisis_LV==1
  g dloginfl=asinh(fd.infl)
  
  qui reghdfe m2gdp l.women_appointment l.m2gdp if WDW_LV==1, a(cid year) cl(cid)
  est store o11
  qui reghdfe crd_gov l.women_appointment l.crd_gov if WDW_LV==1, a(cid year) cl(cid)
  est store o12
  qui reghdfe crd_prv l.women_appointment l.crd_prv if WDW_LV==1, a(cid year) cl(cid)
  est store o13
  qui reghdfe dloginfl l.women_appointment l.dloginfl if WDW_LV==1, a(cid year) cl(cid)
  est store o14
estout o1*, drop(_* ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a idstat, fmt(0 0 3 3))

** Table 3 
estout o1*, style(tex) substitute(_ \_)  drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3) label("Observations" "Countries" "Adjusted-R2")) 

  
  
* Robustness tests and further analysis 
***************************************

* Descriptive statistics

  qui reghdfe women_appointment year, a(cid) cl(cid)
  qui g sample1=e(sample)

  qui estpost su women_appointment crisis_LV crisis_sd crisis_bk crisis_cur women_dism femaleshare IMFnn IMFonset IMFong f_lead f_fm vdem_gender leftany lngdppc fh_inv lnfdi crd_gov crd_prv v2x_corr m2gdp loginfl  if sample1
  esttab ., cells("count mean sd min max")
 
  
* Alternative econometric models

  ** Logit FE 
  qui xtlogit women_appointment l2.crisis_LV l.femaleshare women_dismissals, i(cid) 
  est store r11
  qui xtlogit women_appointment l2.crisis_sd l2.crisis_bk l.femaleshare women_dismissals, i(cid) 
  est store r12
  qui xtlogit women_appointment l2.crisis_sd l2.crisis_bk l2.crisis_cur l.femaleshare women_dismissals, i(cid)
  est store r13
estout r1*, drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_g r2_a, fmt(0 0 3))

** Table IV 
estout r1*, style(tex) substitute(_ \_) drop(_cons ) order(*cris*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_g r2_a, fmt(0 0 3) label("Observations" "Countries" "Adjusted-R2")) 


  ** Number of women --> PPML
  qui ppmlhdfe women_appointment_sum l.crisis_LV l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store r21
  qui ppmlhdfe women_appointment_sum l.crisis_sd l.crisis_bk l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store r22
  qui ppmlhdfe women_appointment_sum l.crisis_sd l.crisis_bk l.crisis_cur l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store r23
estout r2*, drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_g r2_a, fmt(0 0 3))

** Table V
estout r2*, style(tex) substitute(_ \_) drop(_cons ) order(*cris*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_g r2_a, fmt(0 0 3) label("Observations" "Countries" "Adjusted-R2")) 
  
 
* Controlling for CBI
  qui reghdfe women_appointment l2.crisis_sd l.CBIE l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store r31
  qui reghdfe women_appointment l2.crisis_sd l.CBIE $L2X1 l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store r32
  qui reghdfe women_appointment l2.crisis_sd l.CBIE $L2X2 l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store r33
estout r3*, drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))

** Table VI
estout r3*, style(tex) substitute(_ \_)  drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3) label("Observations" "Countries" "Adjusted-R2")) 


* Different control set   
  qui reghdfe women_appointment l2.crisis_sd l2.wdi_wip l2.f_lead, a(cid year) cl(cid)
  est store r41
  qui reghdfe women_appointment l2.crisis_sd l2.wdi_wip l2.f_lead l2.fh_inv l2.lngdppc, a(cid year) cl(cid)
  est store r42
  qui reghdfe women_appointment l2.crisis_sd l2.wdi_wip l2.f_lead l2.fh_inv l2.lngdppc l2.growth l2.loginfl l2.trade l2.KOFFiGI, a(cid year) cl(cid)
  est store r43
estout r4*, drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))

** Table VII
estout r4*, style(tex) substitute(_ \_) order() drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3) label("Observations" "Countries" "Adjusted-R2")) 


* Variation in timing (distributed lag-lead structures)
  qui reghdfe women_appointment F(2/1).crisis_sd crisis_sd L(1/2).crisis_sd  F(2/1).crisis_bk crisis_bk L(1/2).crisis_bk  l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store r51
  qui reghdfe women_appointment F(2/1).crisis_sd crisis_sd L(1/2).crisis_sd F(2/1).crisis_bk crisis_bk L(1/2).crisis_bk $L2X1 l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store r52
  qui reghdfe women_appointment F(2/1).crisis_sd crisis_sd L(1/2).crisis_sd F(2/1).crisis_bk crisis_bk L(1/2).crisis_bk $L2X2 l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store r53
estout r5*, drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))

** Table VIII
estout r5*, style(tex) substitute(_ \_)  drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3) label("Observations" "Countries" "Adjusted-R2")) 


* Women dismissmals (Placebo)
  qui reghdfe women_dism l2.crisis_sd l.femaleshare , a(cid year) cl(cid)
  est store r61
  qui reghdfe women_dism l2.crisis_sd $L2X1 l.femaleshare , a(cid year) cl(cid)
  est store r62
  qui reghdfe women_dism l2.crisis_sd $L2X2 l.femaleshare , a(cid year) cl(cid)
  est store r63
estout r6*, drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))

** Table IX
estout r6*, style(tex) substitute(_ \_)  drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3) label("Observations" "Countries" "Adjusted-R2")) 


* Women triggering the crisis?
  qui reghdfe crisis_LV l.women_appointment l.women_dismissals, a(cid year) cl(cid)
  est store r71
  qui reghdfe crisis_LV l.women_appointment $LX1 l.women_dismissals, a(cid year) cl(cid)
  est store r72
  qui reghdfe crisis_LV l.women_appointment $LX2 l.women_dismissals, a(cid year) cl(cid)
  est store r73
estout r7*, drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))

** Table X
estout r7*, style(tex) substitute(_ \_)  drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3) label("Observations" "Countries" "Adjusted-R2")) 
  

* Women triggering the IMF program? 
  qui reghdfe IMFnn l.women_appointment l.women_dismissals, a(cid year) cl(cid)
  est store r81
  qui reghdfe IMFnn l.women_appointment $LX1 l.women_dismissals, a(cid year) cl(cid)
  est store r82
  qui reghdfe IMFnn l.women_appointment $LX2 l.women_dismissals, a(cid year) cl(cid)
  est store r83
estout r8*, drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))

** Table XI
estout r8*, style(tex) substitute(_ \_)  drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3) label("Observations" "Countries" "Adjusted-R2")) 
  

* Crisis affecting CBI (which in turn drives appointments?)
  qui reghdfe CBIE l.women_appointment l.women_dismissals, a(cid year) cl(cid)
  est store r91
  qui reghdfe CBIE l.women_appointment $LX1 l.women_dismissals, a(cid year) cl(cid)
  est store r92
  qui reghdfe CBIE l.women_appointment $LX2 l.women_dismissals, a(cid year) cl(cid)
  est store r93
estout r9*, drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))

** Table XII
estout r9*, style(tex) substitute(_ \_)  drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3) label("Observations" "Countries" "Adjusted-R2")) 
  

* Crisis affecting political leader change (which in turn drives appointments?)
  qui reghdfe women_appointment l.t_lead_m2f l.women_dismissals l.femaleshare, a(cid year) cl(cid)
  est store r101
  qui reghdfe women_appointment l.t_lead_m2f l.women_dismissals l.femaleshare l.vdem_gender l.leftany l.lngdppc l.fh_inv l.lnfdi l.crd_gov l.crd_prv, a(cid year) cl(cid)
  est store r102
  qui reghdfe women_appointment l.t_fm_m2f l.women_dismissals l.femaleshare, a(cid year) cl(cid)
  est store r103
  qui reghdfe women_appointment l.t_fm_m2f l.women_dismissals l.femaleshare l.vdem_gender l.leftany l.lngdppc l.fh_inv l.lnfdi l.crd_gov l.crd_prv, a(cid year) cl(cid)
  est store r104
estout r10*, drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))

** Table XIII
estout r10*, style(tex) substitute(_ \_)  drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3) label("Observations" "Countries" "Adjusted-R2")) 


* Scope conditions 

  ** Central banks with regulations on lending to government (expect negative interaction with SDC)
  su cbie_lending, d
  g LendReg=cbie_lending>.49
  replace LendReg=. if cbie_lending==.
 
 qui reghdfe women_appointment l.LendReg##l.crisis_sd l.LendReg##l.crisis_bk l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store s11
  qui reghdfe women_appointment l.LendReg##l.crisis_sd l.LendReg##l.crisis_bk $LX1 l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store s12
  qui reghdfe women_appointment l.LendReg##l.crisis_sd l.LendReg##l.crisis_bk $LX2 l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store s13
estout s1*, drop(_cons 0b*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))

** Table XIV
estout s1*, style(tex) substitute(_ \_) order() drop(_cons *0*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3) label("Observations" "Countries" "Adjusted-R2")) 


  ** Central banks with financial regulation competencies (expect negative interaction with banking crisis)  
  su CBIEF, d
  g FinReg=CBIEF>.665
  replace FinReg=. if CBIEF==.
  
  qui reghdfe women_appointment l.FinReg##l.crisis_sd l.FinReg##l.crisis_bk l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store s21
  qui reghdfe women_appointment l.FinReg##l.crisis_sd l.FinReg##l.crisis_bk $LX1 l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store s22
  qui reghdfe women_appointment l.FinReg##l.crisis_sd l.FinReg##l.crisis_bk $LX2 l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store s23
estout s2*, drop(_cons *0*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))

** Table XV
estout s2*, style(tex) substitute(_ \_) order() drop(_cons *0*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3) label("Observations" "Countries" "Adjusted-R2")) 


  ** IMF onset **
  qui reghdfe women_appointment f.IMFnn l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store s31
  qui reghdfe women_appointment f.IMFonset f.IMFongoing l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store s32
  qui reghdfe women_appointment f.IMFonset f.IMFongoing $X1 l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store s33
  qui reghdfe women_appointment f.IMFonset f.IMFongoing $X2 l.femaleshare women_dismissals, a(cid year) cl(cid)
  est store s34
estout s3*, drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))

** Table XVI
estout s3*, style(tex) substitute(_ \_) order(*IMF*) drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3) label("Observations" "Countries" "Adjusted-R2")) 


* Outcomes
  qui reghdfe m2gdp l.dfemaletop_delta l.m2gdp if WDW_LV==1, a(cid year) cl(cid)
  est store o21
  qui reghdfe crd_gov l.dfemaletop_delta l.crd_gov if WDW_LV==1, a(cid year) cl(cid)
  est store o22
  qui reghdfe crd_prv l.dfemaletop_delta l.crd_prv if WDW_LV==1, a(cid year) cl(cid)
  est store o23
  qui reghdfe dloginfl l.dfemaletop_delta l.dloginfl if WDW_LV==1, a(cid year) cl(cid)
  est store o24
estout o2*, drop(_* ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a idstat, fmt(0 0 3 3))

** Table XVII
estout o2*, style(tex) substitute(_ \_)  drop(_cons ) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3) label("Observations" "Countries" "Adjusted-R2")) 


  ** end of do file **
